<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<font>一件裤子：150元</font>
	<button id="a1">-</button>
	<font id="a2">0</font>
	<button id="a3">+</button>
	<font>件</font>
	<font>裤子总价：</font>
	<font id="a4">0</font>
	<br>
	<font>一件上衣：300元</font>
	<button id="b1">-</button>
	<font id="b2">0</font>
	<button id="b3">+</button>
	<font>件</font>
	<font>上衣总价：</font>
	<font id="b4">0</font>
	<br>
	<font>总价：</font>
	<font id="c1">0</font>
	<script type="text/javascript">
		var a1 = document.getElementById('a1');
		var a2 = document.getElementById('a2');
		var a3 = document.getElementById('a3');
		var a4 = document.getElementById('a4');
		var b1 = document.getElementById('b1');
		var b2 = document.getElementById('b2');
		var b3 = document.getElementById('b3');
		var b4 = document.getElementById('b4');
 		var aaa = a4.innerHTML;
		var bbb = b4.innerHTML; 
		a1.onclick = function() {
			if (a2.innerHTML > 0) {
				a2.innerHTML--;
				a4.innerHTML = a2.innerHTML * 150;
				c1.innerHTML = +a4.innerHTML + +b4.innerHTML;
				
			}
		}
		a3.onclick = function() {
			a2.innerHTML++;
			a4.innerHTML = a2.innerHTML * 150;
			c1.innerHTML = +a4.innerHTML + +b4.innerHTML;
		}
		/* a4.innerHTML = a2.innerHTML * 150; */
		b1.onclick = function() {
			if (b2.innerHTML > 0) {
				b2.innerHTML--;
				b4.innerHTML = b2.innerHTML * 300;
				c1.innerHTML = +a4.innerHTML + +b4.innerHTML;
			}
		}
		b3.onclick = function() {
			b2.innerHTML++;
			b4.innerHTML = b2.innerHTML * 300;
			c1.innerHTML = +a4.innerHTML + +b4.innerHTML;
		}
		/* b4.innerHTML = b2.innerHTML * 300; */
		/* c1.innerHTML = a4.innerHTML + b4.innerHTML; */
	</script>
</body>
</html>